package com.sbtr.business.feature.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.util.ArrayList;
import java.util.List;


/**
 * 主成分分析规则结果集
 *
 * @author dgl
 * @since 2023-05-08
 */
@Data
@Accessors(chain = true)
@ApiModel(value="FePcaRuleResultDto对象")
public class FePcaRuleResultDto{
    @ApiModelProperty(value = "计算选取的主成分txt")
    private List<List<Double>> proj_matrix;

    @ApiModelProperty(value = "计算方差贡献率")
    private List<Double> var_exp;

    @ApiModelProperty(value = "降维后的数据")
    private List<List<Double>> X_pca;

    public void insertNull(List<Integer> overLine){
        List<List<Double>> X_pca2 = new ArrayList<>();
        for (int i = 0; i < this.X_pca.size(); i++) {
            for (Integer n:overLine) {
                if(i==n){
                    X_pca2.add(new ArrayList<>());
                }
            }
            X_pca2.add(this.X_pca.get(i));
        }
        this.X_pca=X_pca2;

        List<List<Double>> proj_matrix2 = new ArrayList<>();
        for (int i = 0; i < this.proj_matrix.size(); i++) {
            for (Integer n:overLine) {
                if(i==n){
                    proj_matrix2.add(new ArrayList<>());
                }
            }
            proj_matrix2.add(this.proj_matrix.get(i));
        }
        this.proj_matrix=proj_matrix2;


    }

}
